{extend name="../../base/view/layout" /}
{block name="my_body"}
<div class="widgetbox box-inverse">
    <div class="widgetcontent wc1">

        <form id="form1" class="stdform" enctype="multipart/form-data" method="post" action="<?php echo url('shop/Shop/edit');?>">

            <div class="tabbable">
                <ul class="nav nav-tabs buttons-icons">
                    <li class="active"><a data-toggle="tab" href="#shop_info">基本信息</a></li>
                    <li><a data-toggle="tab" href="#shop_content">店铺描述</a></li>
                </ul>
                <div class="tab-content">
                    <div id="shop_info" class="tab-pane active">

                        <div class="par control-group">
                            <label class="control-label" for="title">店铺名称</label>
                            <div class="controls"><input type="text" name="title" id="title" class="input-xlarge" value="<?php echo $data['title'];?>" /></div>
                        </div>
                        <div class="par control-group">
                            <label class="control-label" for="channel_id">渠道ID</label>
                            <div class="controls"><input type="text" name="channel_id" id="channel_id" class="input-xlarge" value="<?php echo $data['channel_id'];?>" /></div>
                        </div>

                        <input type="hidden" name="id" value="<?php echo $data['id'];?>" class="input-xlarge" />
                        <div class="par control-group">
                            <label class="control-label" for="sheng_id">店铺地区</label>
                            <span class="field">
                            <select name="sheng_id" class="uniformselect" id="sheng_id">
                            	<option value="">--请选择省份--</option>
                                <?php foreach($cityData as $k=>$v):?>
                                 <option value="<?php echo $v['id'];?>" <?php if($data['sheng_id'] == $v['id']) echo "selected";?> ><?php echo $v['name'];?></option>
                                <?php endforeach;?>
                            </select>
                            </span>
                        </div>
                        <div class="par control-group">
                            <label class="control-label" for="shi_id"></label>
                            <span class="field">
                            <select name="shi_id" class="uniformselect" id="shi_id">
                            	<option value="<?php echo $data['shi_id'];?>"><?php echo $data['shi_name'];?></option>
                            </select>
                            </span>
                        </div>

                        <div class="par control-group">
                            <label class="control-label" for="xian_id"></label>
                            <span class="field">
                            <select name="xian_id" class="uniformselect" id="xian_id">
                            	<option value="<?php echo $data['xian_id'];?>"><?php echo $data['xian_name'];?></option>
                            </select>
                            </span>
                        </div>

                        <div class="par control-group">
                            <label class="control-label" for="coordinate">坐标位置</label>
                            <div class="controls"><input type="text" name="coordinate" id="coordinate" class="input-xlarge" value="<?php echo $data['coordinate'];?>" />&ensp;<a href="http://api.map.baidu.com/lbsapi/getpoint/index.html" target="_blank">选择坐标</a></div>
                        </div>



                        <div class="par control-group">
                            <label class="control-label" for="address">详细地址</label>
                            <div class="controls"><input type="text" name="address" id="address" class="input-xlarge" value="<?php echo $data['address'];?>" /></div>
                        </div>

                        <div class="par control-group">
                            <label class="control-label" for="contacts">联系人</label>
                            <div class="controls"><input type="text" name="contacts" id="contacts" class="input-xlarge" value="<?php echo $data['contacts'];?>" /></div>
                        </div>

                        <div class="par control-group">
                            <label class="control-label" for="tel">联系方式</label>
                            <div class="controls"><input type="text" name="tel" id="tel" class="input-xlarge" value="<?php echo $data['tel'];?>" /></div>
                        </div>

                        <div class="par control-group">
                            <label class="control-label" for="shop_intro">店铺简介</label>
                            <div class="controls"><textarea name="shop_intro" id="shop_intro" rows="5" class="input-xlarge" ><?php echo $data['shop_intro'];?></textarea></div>
                        </div>

                        <div class="control-group par">
                            <label class="control-label" for="logo">店铺Logo</label>
                            <div class="controls"><input type="file" name="logo" id="logo" class="input-xlarge"  /></div>
                        </div>

                        <?php if(!empty($data['sm_logo'])):?>
                        <div class="control-group par">
                            <label class="control-label" for="logo">店铺Logo-原图</label>
                            <div class="controls"><?php showImage($data['sm_logo']);?></div>
                        </div>
                        <?php endif;?>

                        <div class="control-group par">
                            <label class="control-label" for="erweima">店铺二维码</label>
                            <div class="controls"><input type="file" name="erweima" id="erweima" class="input-xlarge"  /></div>
                        </div>

                        <?php if(!empty($data['erweima'])):?>
                        <div class="control-group par">
                            <label class="control-label" for="logo">店铺二维码-原图</label>
                            <div class="controls"><?php showImage($data['erweima']);?></div>
                        </div>
                        <?php endif;?>

                    </div><!--tab-pane-->
                    <div id="shop_content" class="tab-pane">

                        <textarea id="goods_desc" name="content" ><?php echo $data['content'];?></textarea>

                    </div>

                </div><!--tabcontent-->
            </div><!--tabbable-->


            <p class="stdformbutton">
                <input type="submit" class="btn btn-primary" />
            </p>
        </form>
    </div><!--widgetcontent-->
</div><!--widget-->
{/block}

{block name="my_js"}
<script>
    var $ = jQuery.noConflict();
</script>
<!-- 配置文件 -->
<script type="text/javascript" src="/qiniu_ueditor_1.4.3/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/qiniu_ueditor_1.4.3/ueditor.all.js"></script>
<script>
    UE.getEditor('goods_desc', {
        initialFrameWidth : "100%",
        initialFrameHeight : "500"
    });


    //地区三级联动
    //市
    $('#sheng_id').change(function(){
        var id=$(this).val();
        var url = "<?php echo url('base/City/getCityById');?>";
        $.ajax({
            url:url+'?id='+id,
            type:"GET",
            dataType:"json",
            success:function(data){
                var option="<option value=''>--请选择--</option>";
                $(data).each(function(k,v){
                    option +="<option value='"+v.id+"'>";
                    option +=v.name;
                    option +="</option>";
                })
                $('#shi_id').empty();
                $('#shi_id').append(option);
            }
        });
    });
    //区
    $('#shi_id').change(function(){
        var id=$(this).val();
        var url = "<?php echo url('base/City/getCityById');?>";
        $.ajax({
            url:url+'?id='+id,
            type:"GET",
            dataType:"json",
            success:function(data){
                var option="<option value=''>--请选择--</option>";
                $(data).each(function(k,v){
                    option +="<option value='"+v.id+"'>";
                    option +=v.name;
                    option +="</option>";
                })
                $('#xian_id').empty();
                $('#xian_id').append(option);
            }
        });
    });
</script>
{/block}